home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <exec/types.h>
- #include "dh0:code/code20/defines.h"
-
- struct Commands Cmds;
-
- char dest[200];
- char bbsdest[200];
- char bbs[200];
- void MakeStruct();
- void ReadConfig();
- void sr(char *str);
- main(int argc, char *argv[])
- {
- if(argc!=3)
- {
- printf("\n");
- printf("AmiExpress Structure BackUp v1.0 written by Joseph Hodge\n");
- printf("\n");
- printf("Usage: BACKUPBBS <complete config path> <destination Volume>\n");
- printf(" ie: BACKUPBBS bbs:config1 df0:\n\n");
- printf("This utility will include only 1 node to destination\n");
- printf("Compatible with AmiExpress 1.1x\n\n");
- exit(0);
- }
-
- strcpy(bbs,argv[1]);
- strcpy(dest,argv[2]);
- sr(bbs);
- sr(dest);
- if(dest[strlen(dest)-1]!=':')
- {
- printf("Error!! Destination must be either a Device or Volume\n\n");
- exit(0);
- }
- ReadConfig();
- MakeStruct();
-
- printf("AmiExpress Structure Backup complete\n");
- printf("\n");
- exit(0);
- }
-
- void ReadConfig()
- {
- FILE *fi;
- fi=fopen(bbs,"rb");
- if(fi==NULL)
- {
- printf("Error!! can't open config file\n\n");
- exit(0);
- }
- printf("Standby... Reading BBS configuration\n\n");
- fread((APTR)&Cmds,sizeof(struct Commands),1,fi);
- fclose(fi);
- printf("Configuration Read\n");
- }
-
- char Conf[9][60];
-
- void MakeStruct()
- {
- char s[200],d[200],c[200];
- register int i,j,k;
- strcpy(bbsdest,Cmds.BBSLoc);
- if(bbsdest[strlen(bbsdest)-1]==':')
- bbsdest[strlen(bbsdest)-1]='\0';
- sprintf(d,"%s%s",dest,bbsdest);
- mkdir(d);
- sprintf(d,"%s%s/Node%d",dest,bbsdest,Cmds.AcLvl[44]);
- mkdir(d);
- sprintf(s,"%s/Work",d);
- mkdir(s);
- sprintf(s,"%s/PlayPen",d);
- mkdir(s);
- i=0;
- while(i<9)
- {
- if(Cmds.ConfLoc[i][0]!='\0')
- {
- strcpy(Conf[i],Cmds.ConfLoc[i]);
- j=0;
- k=strlen(Conf[i]);
- while(j<k)
- {
- if(Conf[i][j]==':') Conf[i][j]='/';
- j++;
- }
- if(Conf[i][strlen(Conf[i])-1]=='/') Conf[i][strlen(Conf[i])-1]='\0';
- sprintf(d,"%s%s",dest,Conf[i]);
- mkdir(d);
- sprintf(s,"%s/Bulletins",d);
- mkdir(s);
- sprintf(c,"Copy %sBulletins/#? %s",Cmds.ConfLoc[i],s);
- Execute(c,NULL,NULL);
- sprintf(s,"%s/MsgBase",d);
- mkdir(s);
- sprintf(c,"Copy %sMsgBase/#? %s",Cmds.ConfLoc[i],s);
- Execute(c,NULL,NULL);
- sprintf(c,"%s/LCFiles",d);
- mkdir(c);
- sprintf(c,"Copy %s#? %s QUIET",Cmds.ConfLoc[i],d);
- Execute(c,NULL,NULL);
- sprintf(s,"%s/PartUpload",d);
- mkdir(s);
- }
- i++;
- }
- sprintf(s,"%sNode%d",Cmds.BBSLoc,Cmds.AcLvl[44]);
- sprintf(d,"Copy %s/#? %s%s/Node%d QUIET",s,dest,bbsdest,Cmds.AcLvl[44]);
- Execute(d,NULL,NULL);
- sprintf(s,"Copy %s#? %s%s QUIET",Cmds.BBSLoc,dest,bbsdest);
-
- Execute(s,NULL,NULL);
- }
-
-
- void sr(char *str)
- {
- register int i;
- i=strlen(str)-1;
- while(i)
- {
- if(*(str+i)<=' ') *(str+i)='\0'; else break;
- i--;
- }
- }